
#include <stdio.h>
#include "timer.h"
#include "device.h"


static  sj_int8  timer_device_open(struct file *file_node)
{
    sj_int8 ret =0;
    return ret;
}

static  sj_int8  timer_device_close(struct file *file_node)
{
    sj_int8 ret =0;
    return  ret;
}

static  sj_int8  timer_device_poll(struct file *file_node,sj_int32 timeout)
{
    sj_int8 ret =0;

    return ret;
}

static sj_int8 timer_device_probe(struct device *dev)
{
    sj_int8 ret =0;
    struct timer_device_data *self_data =(struct timer_device_data *)dev->private_data;
    if(!self_data)
    {
        ret =-1;
        goto out;
    }
    struct rcc_apb_periph *apb= &self_data->rcc_apb;

    periph_clock_config(apb);

    peripheral_timer_init(&self_data->timer);

    peripheral_nvic_init(&self_data->nvic);
out:
    return ret;
}

static sj_int8 timer_device_ioctl(struct file *file_node,sj_int8 cmd ,sj_uint8 *data)
{
    sj_int8 ret =0;

    switch(cmd)
    {

        default:
            break;
    }

    return ret;
}

static struct file_operations timer_opt =
{
    timer_device_open,
    timer_device_close,
    NULL,
    NULL,
    NULL,
    NULL,
    timer_device_poll,
    timer_device_ioctl,
};

static struct device_id_table timer_id_table[]=
{
    {"timer"},
    {NULL}
};

static struct device_driver timer_driver={
    "timer",
    timer_id_table,
    &timer_opt,
    timer_device_probe,
    NULL,
    NULL,
    NULL,
    NULL,
};


static DRIVER_MODULE_INIT(timer_driver)


